<%@ page language="java" pageEncoding="ISO-8859-1"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>


<h2>B&uacute;squeda de Clientes</h2>

<html:form action="/buscarClientes.do" method="POST">
	<h5><span class="error"><html:errors property="errorValidacion"/></span></h5>
	<fieldset><legend>Par&aacute;metros de b&uacute;squeda</legend>
		<table>
		  <tr height="7px"/>
		  <tr>
		    <td class="colIzq">
		    	<label for="txt_folio">Nombre: </label>
		    </td>
		    <td class="colDer">
		    	<html:text property="nombre"/>
		    </td>
		    <td class="colIzq">
		    	<label for="sel_estatus">Fecha de: </label>
		    </td>
		    <td class="colDer">
		    	<html:text styleId="f_date1" property="fechaInicio"/><button id="f_btn1">...</button>
		    </td>
		  </tr>
		  
		  
		  <tr>
		    <td class="colIzq">
		    	<label for="txt_cliente">RFC: </label>
		    </td>
		    <td class="colDer">
		    	<html:text property="rfc"/>
		    </td>
		    <td class="colIzq">
		    	<label for="sel_estatus">Fecha hasta: </label>
		    </td>
		    <td class="colDer">
		    	<html:text styleId="f_date2" property="fechaFin"/><button id="f_btn2">...</button>
		    </td>
		  </tr>
		  
		  
		  <tr>
		  	<td class="colIzq">
		    	<label for="txt_cliente">Contacto: </label>
		    </td>
		    <td class="colDer">
		    	<html:text property="contacto"/>
		    </td>
		    <td class="colIzq">
		    	<label for="sel_estatus">Estatus: </label>
		    </td>
		    <td class="colDer">
		    	<html:select property="estatus">
					<html:option value="0">Seleccione una opci&oacute;n</html:option>
					<html:optionsCollection name="estatusEmpresa" label="status" value="id"/>
				</html:select>
		    </td>
		  </tr>
		  <tr height="7px"/>
		  <tr>
		  	<td width="100%" colspan="4">
		  	  <div align="center">
			  	<html:submit property="boton" value="BUSCAR"/>
			    <html:submit property="boton" value="LIMPIAR"/>
			  </div>
		  	</td>
		  </tr>
		  <tr height="7px"/>
		</table>
	</fieldset>


<br/>
<br/>


<div id="tablewrapper">
		<div id="tableheader">
        	<div class="search">
                <select id="columns" onchange="sorter.search('query')"></select>
                <input type="text" id="query" onkeyup="sorter.search('query')" />
            </div>
            <span class="details">
				<div>Registros <span id="startrecord"></span>-<span id="endrecord"></span> de <span id="totalrecords"></span></div>
        		<div><a href="javascript:sorter.reset()">Restaurar</a></div>
        	</span>
        </div>
        <table cellpadding="0" cellspacing="0" border="0" id="table" class="tinytable">
            <thead>
                <tr>
                    <th><h3>ID</h3></th>
                    <th><h3>Cliente</h3></th>
                    <th><h3>Contacto</h3></th>
                    <th><h3>Tel&eacute;fono</h3></th>
                    <th><h3>Estatus</h3></th>
                    <th><h3>Fecha Alta</h3></th>
                    <th class="nosort"><h3>Consultar</h3></th>
                </tr>
            </thead>
            <tbody>
                
            <logic:iterate id="Cliente" name="listaClientes">
            	<tr>
            		<td>
            			<bean:write name="Cliente" property="idLaborales"/>
            		</td>
            		<td>
            			<bean:write name="Cliente" property="nombre"/>
            		</td>
            		<td>
            			<bean:write name="Cliente" property="contacto1"/>
            		</td>
            		<td>
            			<bean:write name="Cliente" property="telefono1"/>
            		</td>
            		<td>
            			<bean:write name="Cliente" property="estatusStr"/>
            		</td>
            		<td>
            			<bean:write name="Cliente" property="fechaAltaStr"/>
            		</td>
            		<td align="center">
                    	<html:link action="registrarCliente" paramId="cliente" paramName="Cliente" paramProperty="idLaborales">
                    		<html:img src="../../imagenes/right.png"/>
                    	</html:link>
                    	<html:link action="/buscarClientes.do" paramId="cliente" paramName="Cliente" paramProperty="idLaborales"
							title="Eliminar" onclick="return confirm('Esta seguro que desea eliminar este registro?');">
							<html:img src="../../imagenes/close.png"/>
						</html:link>
                    </td>	
            	</tr>
            </logic:iterate>
            
            </tbody>
        </table>
        <div id="tablefooter">
          <div id="tablenav">
            	<div>
                    <img src="../../imagenes/first.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1,true)" />
                    <img src="../../imagenes/previous.gif" width="16" height="16" alt="First Page" onclick="sorter.move(-1)" />
                    <img src="../../imagenes/next.gif" width="16" height="16" alt="First Page" onclick="sorter.move(1)" />
                    <img src="../../imagenes/last.gif" width="16" height="16" alt="Last Page" onclick="sorter.move(1,true)" />
                </div>
                <div>
                	<select id="pagedropdown"></select>
				</div>
                <div>
                	<a href="javascript:sorter.showall()">Mostrar todo</a>
                </div>
            </div>
			<div id="tablelocation">
            	<div>
                    <select onchange="sorter.size(this.value)">
                    <option value="5">5</option>
                        <option value="10" selected="selected">10</option>
                        <option value="20">20</option>
                        <option value="50">50</option>
                        <option value="100">100</option>
                    </select>
                    <span>Registros por p&aacute;gina</span>
                </div>
                <div class="page">P&aacute;gina <span id="currentpage"></span> de <span id="totalpages"></span></div>
            </div>
        </div>
    </div>
    <br/>
    <div align="center">
    	<html:cancel property="boton" value="CANCELAR"/>
    </div>


    <script type="text/javascript">
	var sorter = new TINY.table.sorter('sorter','table',{
		headclass:'head',
		ascclass:'asc',
		descclass:'desc',
		evenclass:'evenrow',
		oddclass:'oddrow',
		evenselclass:'evenselected',
		oddselclass:'oddselected',
		paginate:true,
		size:10,
		colddid:'columns',
		currentid:'currentpage',
		totalid:'totalpages',
		startingrecid:'startrecord',
		endingrecid:'endrecord',
		totalrecid:'totalrecords',
		hoverid:'selectedrow',
		pageddid:'pagedropdown',
		navid:'tablenav',
		sortcolumn:1,
		sortdir:1,
		sum:[8],
		avg:[6,7,8,9],
		columns:[{index:7, format:'%', decimals:1},{index:8, format:'$', decimals:0}],
		init:true
	});
  </script>



<script type="text/javascript">//<![CDATA[
      var cal = Calendar.setup({
          onSelect: function(cal) { cal.hide() },
          showTime: false
      });
      cal.manageFields("f_btn1", "f_date1", "%Y-%m-%d");
      cal.manageFields("f_btn2", "f_date2", "%Y-%m-%d");
//]]></script>

</html:form>